﻿//Copyright (C) <2013>  <jonathan cleeve norton> All Rights Reserved 
//Contact jon.norton@fin-plus.co.uk website <http://www.fin-plus.co.uk/>
using System;
using System.Windows;
using System.Windows.Controls.Primitives;
using FinPlusInterfaces;

namespace FinPlusCompView
{
    public partial class FinPlusWait : Popup, IFinPlusComp
    {
        [State(Test = true)]
        public bool IsValid { get; set; }
        public string Id { get; set; }
        public string LinkedId { get; set; }
        public string Config { get; set; }
        public string TestString { get; private set; }
        public Env Env { get; set; }
        public IPods Adapter { get { return null; } }

        //construct
        public FinPlusWait(UIElement placementTarget, string text)
        {
            PlacementTarget = this;
            InitializeComponent();
            display.Text = text;
            PlacementTarget = placementTarget;
            var window = placementTarget.FindVisualParent<FinPlusWindow>();
            window.LocationChanged += Window_Move;
            window.SizeChanged += Window_Move;
        }

        //common control interface
        public void Dock(object control, string dock) 
        {
            IsValid = false;
            throw new NotImplementedException();
        }

        public void CmdExecute(IPod command)
        { 
            IsValid = false;
            throw new NotImplementedException();
        }

        public void Dispose()
        {
            IsOpen = false;
        }

        //events
        private void Window_Move(object s, EventArgs a)
        {
            var offset = HorizontalOffset;
            HorizontalOffset = offset + 1;
            HorizontalOffset = offset;
        }
    }
}
